home *** CD-ROM | disk | FTP | other *** search
- #include "fcntl.h"
- #include "sys\types.h"
- #include "sys\stat.h"
- #include "process.h"
- #include "string.h"
- #include "direct.h"
- #include "io.h"
- #include "stdio.h"
- #include "stdlib.h"
-
- #define FILE_ERR -1
-
- void main(argc,argv)
- int argc;
- char *argv[];
- {
- int i,handle,result,fcount;
- long cumm_size;
- char path[65];
- struct stat stat_buf;
-
- cumm_size=0L;
- fcount=0;
-
- printf("\nFSIZE.EXE by Bryan D. Kaiser");
- if(argc==1){
- printf("\nNo files specified\nUsage:FSIZE [FILE SPEC]");
- exit(0);
- }
-
- for(i=1;i < argc;i++){
- if((result = stat(argv[i],&stat_buf)) != 0){
- strcpy(path,"\n");
- strcat(path,argv[i]);
- perror(path);
- exit(0);
- }
- if(stat_buf.st_mode & S_IFDIR)
- continue;
-
- cumm_size += stat_buf.st_size;
- ++fcount;
- printf("\n%-*s%7ld",strlen(argv[1])+11,strlwr(argv[i]),stat_buf.st_size);
- }
-
- printf("\n\n%d files occupy %ld bytes\n",fcount,cumm_size);
-
- }